<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@taglib prefix="s" uri="/struts-tags"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>接收公文</title>
<link rel="stylesheet" href="<%=request.getContextPath()%>/css/main.css"
	type="text/css" />
<script type="text/javascript" src="js/jquery-1.8.3.js"></script>
<script type="text/javascript">
function getSortType(){
	var sortId = document.getElementById("sort").value;
	$.ajax({
        type:"post",        
        async:true,    //是否异步
        url:"later_news_objectToJson.action",
        data:"sortId="+sortId,
        dataType:"json",    
        success:function(data){
        	var friends = $("#ddlDatas");
        	friends.empty(); 
        	var def = $("<option>").text("----请选择二级栏目----").val(0);
        	friends.append(def);
             data.forEach(function(val,index) {        
            	var option =$("<option>").text(val.name).val(val.id);
            	friends.append(option);
             });
        } 
    });    
}
</script>
</head>
<body>
	<jsp:include page="nav.jsp" />
	<table class="ct" width="900" align="center" cellpadding="0"
		cellspacing="0">
		<tr>
		<td colspan="5">
		<form action="document_listReceive.action" method="get">
			关键字:<input name="con" value="${con }"/> 
			选择一级栏目:<s:select theme="simple" list="#ds" name="sortId" 
					listKey="id" listValue="name" headerKey="0" headerValue="选择部门" onchange="getSortType()"/>
		          选择二级栏目:<select name="SortTypeId" id="ddlDatas" style="width:120px;font-size:12px">
		            </select>
			<input type="submit" value="检索"/>
		</form>
		</td>
		</tr>
		<tr>
			<td>新闻id</td>
			<td>新闻标题</td>
			<td>新闻作者</td>
			<td>发布时间</td>
			<td>操作</td>
		</tr>
		<s:if test="#pages.totalRecord==0">
			<tr>
				<td colspan="6">没有消息存在</td>
			</tr>
		</s:if>
		<s:else>
			<s:iterator value="#pages.datas">
				<tr>
					<td>${id }</td>
					<td><a href="later_news_show.action?sortId=${sort.id}">${title}</a></td>
					<td>${user.nickname }</td>
					<td><s:date name="createDate" format="yyyy-MM-dd"/></td>
					<td><a href="later_news_delete.action?id=${id }">删除</a>&nbsp;&nbsp;
					    <a href="later_news_updateInput.action?id=${id}&sortId=${sort.id}">修改</a>
					</td>
					<td>&nbsp;</td>
				</tr>
			</s:iterator>
		</s:else>
	</table>
</body>
</html>